﻿using log4net;
using Quartz;
using System;
using System.Threading;
using WMSSyncData.Core;

namespace WMSSyncData.ToERP
{
    public class SyncJob : IJob
    {
        private readonly ILog _logger = LogManager.GetLogger(typeof(SyncJob));
        public void Execute(IJobExecutionContext context)
        {
            try
            {
                new Thread(() =>
                {
                    _logger.Info("WMSSyncToERP.InStockSync作业执行开始!");
                    string msg = new WMSSyncToERP().InStockSync();
                    _logger.Info(msg);
                    _logger.Info("WMSSyncToERP.InStockSync作业执行结束!");
                }).Start();
                new Thread(() =>
                {
                    _logger.Info("WMSSyncToERP.OutStockMSync作业执行开始!");
                    new WMSSyncToERP().OutStockMSync();
                    _logger.Info("WMSSyncToERP.OutStockMSync作业执行结束!");
                }).Start();
            }
            catch (Exception)
            {
            }

            new Thread(() =>
            {
                try
                {
                    _logger.Info("库位状态UPD Start!");
                    new WMSSyncToERP().UpdateLocationStatus();
                    _logger.Info("库位状态UPD End!");
                }
                catch { }
            }).Start();
        }
    }
}
